package Repository;

public class RepositoryFactory {
	
	static Repository leadRepository = null;
	static Repository opportunityRepository = null;
	static Repository contractRepository = null;
	static Repository ruleRepository = null;
	static Repository territoryRepository = null;
	static Repository accountRepository = null;

	
	public static Repository getRepository(String smsobjType){
		if(smsobjType.equals("Lead"))
		{
			if(leadRepository == null)
			leadRepository =  new LeadRepository();
			
			return leadRepository;
		}
		if(smsobjType.equals("Rule")){
			if(ruleRepository == null)
				ruleRepository =  new RuleRepository();
				
				return ruleRepository;
		}
		/*if(smsobjType.equals("Territory")){
			if(territoryRepository == null)
				territoryRepository =  new TerritoryRepository();
				
				return territoryRepository;
		}*/
		if(smsobjType.equals("Opportunity")){
			if(opportunityRepository == null)
				opportunityRepository =  new OpportunityRepository();
				
				return opportunityRepository;
		}
		if(smsobjType.equals("Contract")){
			if(contractRepository == null)
				contractRepository =  new ContractRepository();
				
				return contractRepository;
		}if(smsobjType.equals("Account")){
			if(accountRepository == null)
				//accountRepository =  new AccountRepository();
				
				return accountRepository;
		}
		return null;
	}
	

}
